home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 6 code / TCP / NewsWatcher / NW Source / Shared Code / Reusable Source / genutil.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-04  |  1021 b   |  42 lines  |  [TEXT/MMCC]

  1. /*----------------------------------------------------------------------------
  2.  
  3.     genutil.c
  4.  
  5.     This reusable module contains miscellaneous general-purpose 
  6.     utility routines.
  7.     
  8.     Copyright ©1995, Northwestern University.
  9.  
  10. ----------------------------------------------------------------------------*/
  11.  
  12. #include "genutil.h"
  13.  
  14.  
  15.  
  16. /*----------------------------------------------------------------------------
  17.     MyTrapAvailable
  18.     
  19.     Check to see if a trap exists.
  20.     
  21.     Entry:    theTrap = trap number.
  22.     
  23.     Exit:    function result = true if trap exists.
  24.     
  25.     (From NIM:OS Utils p. 8-22)
  26. ----------------------------------------------------------------------------*/
  27.  
  28. Boolean MyTrapAvailable (unsigned long theTrap)
  29. {
  30.     TrapType    trapType;
  31.     
  32.     trapType = (theTrap & 0x0800) == 0 ? OSTrap : ToolTrap;
  33.     if (trapType == ToolTrap && (theTrap & 0x3ff) >= 200 &&
  34.         GetToolboxTrapAddress(0xA86E) == GetToolboxTrapAddress(0xAA6E))
  35.     {
  36.         return false;
  37.     } else {
  38.         return NGetTrapAddress(theTrap, trapType) != 
  39.             GetToolboxTrapAddress(_Unimplemented);
  40.     }
  41. }
  42.